<?php
namespace app\index\model;
use think\model;
class brand extends Model
{
    public function searchIfshowAttr($q,$v,$d)
    {
        $q->where('if_show','=',"$v");
    }
    public function searchRecommendedAttr($q,$v,$d)
    {
        $q->where('recommended','=',"$v");
    }
    public function searchKeywordsAttr($q,$v,$d)
    {
        $q->where('brand_name','like',"%{$v}%");
    }
    public function searchImgAttr($q,$v,$d)
    {
        $q->where('brand_logo','<>',"");
    }
    public function searchImg1Attr($q,$v,$d)
    {
        $q->where('brand_logo','=',"");
    }

    public static function brand($where)
    {
        $brand=brand::
            withSearch(array_keys($where),$where)
            ->paginate([
                'list_rows'=>5,
                'query'=>$where
            ]);
        return $brand;
    }
}